package com.caration.shell.workspace3D;

import android.graphics.Bitmap;

import com.caration.shell.item.AppWidgetInfo;
import com.caration.shell.workspace2D.ScreenLayout;

public class de {
	public TextureElement a;
	public com.tsf.shell.workspace3D.h.a b;
	private AppWidgetInfo mWidgetInfo;
	private boolean d = false;

	private void d() {
		if (this.a != null) {
			com.censivn.C3DEngine.a.h().a(this.a);
			this.a = null;
		}
	}

	public final void a() {
		this.d = true;
	}

	public final void setWidget(AppWidgetInfo widgetInfo) {
		mWidgetInfo = widgetInfo;
	}

	public final void a(ScreenLayout.LayoutParams paramLayoutParams,
			Bitmap paramBitmap, boolean paramBoolean) {
		int j = paramLayoutParams.f;
		int i = paramLayoutParams.g;
		if (this.b == null) {
			this.b = new com.tsf.shell.workspace3D.h.a(
					com.censivn.C3DEngine.h.a.a(paramBitmap.getWidth()),
					com.censivn.C3DEngine.h.a.a(paramBitmap.getHeight()),
					mWidgetInfo);
			fm.h().d(mWidgetInfo.d).d(this.b);
		}
		int m;
		int k;
		if ((this.d) && (!paramBoolean)) {
			d();
			m = com.censivn.C3DEngine.h.a.a(paramBitmap.getWidth());
			k = com.censivn.C3DEngine.h.a.a(paramBitmap.getHeight());
			this.b.b(m, k);
			this.d = false;
		}
		if (this.a != null) {
			com.censivn.C3DEngine.a.h().a(this.a, paramBitmap);
		} else {
			m = com.censivn.C3DEngine.h.a.a(paramBitmap.getWidth());
			k = com.censivn.C3DEngine.h.a.a(paramBitmap.getHeight());
			this.a = com.censivn.C3DEngine.a.h().a(paramBitmap, m, k);
			this.b.a(this.a);
		}
		this.b.c(j, i);
		com.tsf.shell.workspace3D.h.a.q();
	}

	public final boolean b() {
		return this.d;
	}

	public final void c() {
		this.b = null;
		mWidgetInfo = null;
		d();
	}
}
